<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>方法与事件处理器</title>
    </head>
    <body>
        <script src="../libs/vue.js" charset="utf-8"></script>

        <!-- 方法处理器 -->
        <!-- <div id="example">
            <button v-on:click="greet">Greet</button>
        </div>
        <script>
            var vm = new Vue({
                el: "#example",
                data: {
                    name: "Vue.js"
                },
                methods: {
                    greet: function(event) {
                        alert(this.name);
                        alert(event.target.tagName);
                    }
                }
            })
        </script> -->

        <!-- 内联语句处理器 -->
        <button id="example-2" v-on:click="say('hello!',$event)">click</button>
        <script>
          var vm = new Vue({
            el:"#example-2",
            methods:{
              say:function (msg, event) {
                alert(event.target.tagName);
              }
            }
          })
        </script>
    </body>
</html>
